﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.HomeServer.SDK.Interop.v1;
using Umbrella.Whs.Contracts;

public static class IUserInfoExtensionMethods
{
    public static ListViewItem CreateItem(this UserInfo ui)
    {
        if (ui == null)
            throw new NullReferenceException("this is null");

        var i = new ListViewItem(
            ui.FullName,
            0
            );

        i.SubItems.Add(ui.Login);

        // user is disabled?
        if (!ui.Enabled)
        {
            i.ImageIndex = 1;
            i.ForeColor = Color.Gray;
            i.SubItems.Add(Umbrella.Whs.WhsAddin.Properties.Resources.txtUserIsDisabledOrNoRemoteAccess);
        }
        else
        {
            // add access right
            i.SubItems.Add("foo");
        }

        return i;
    }
}
